import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'Test.dart';

void main() => runApp(SampleApp());

class SampleApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Fade Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyFadeTest(title: 'Fade Demo'),
    );
  }
}

class MyFadeTest extends StatefulWidget {
  MyFadeTest({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyFadeTest createState() => _MyFadeTest();
}

class _MyFadeTest extends State<MyFadeTest> with TickerProviderStateMixin {
  AnimationController controller;
  CurvedAnimation curve;

  @override
  void initState() {
    controller = AnimationController(duration: const Duration(milliseconds: 100), vsync: this);
    curve = CurvedAnimation(parent: controller, curve: Curves.easeInOut);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
          child: Container(
              child: FadeTransition(
                  opacity: curve,
                  child: FlutterLogo(
                    size: 100.0,
                  )
              )
          )
      ),
      floatingActionButton: FloatingActionButton(
        tooltip: 'Fade',
        child: Icon(Icons.brush),
        onPressed: () {
          controller.forward();
        },
      ),
    );
  }

  @override
  dispose() {
    controller.dispose();
    super.dispose();
  }
}


//class SimpleApp extends StatelessWidget {
//  @override
//  Widget build(BuildContext context) {
//    // TODO: implement build
//    return MaterialApp(
//      title: "Simple iOS App",
//      theme: ThemeData(
//        primarySwatch: Colors.amber,
//      ),
//      home: SampleAppPage(),
//    );
//  }
//}
//
//class SampleAppPage extends StatefulWidget {
//  @override
//  State<StatefulWidget> createState() {
//    // TODO: implement createState
//    return _SampleAppPageState();
//  }
//}
//
//class _SampleAppPageState extends State<StatefulWidget> {
//  String textToShow = 'I like Awesome';
//
//  void _updateText() {
//    setState(() {
//      textToShow =
//          textToShow == 'I like Awesome' ? 'Flutter is Awe' : 'I like Awesome';
//    });
//  }
//
//  var _pressedCount = 100.0;
//
//  bool toggle = true;
//
//  void _toggle() {
//    setState(() {
//      toggle = !toggle;
//    });
//  }
//
//  _getToggleChild() {
//    if (toggle) {
//      return Text('Toggle One');
//    } else {
//      return CupertinoButton(
//        onPressed: () {},
//        child: Text('Toggle Two'),
//        padding: EdgeInsets.only(left: 40,right: 40,top: 40),
//      );
//    }
//  }
//
//  @override
//  Widget build(BuildContext context) {
//    return Scaffold(
//      appBar: AppBar(
//        title: Text("Sample App"),
//      ),
//      body: Center(
//        child: _getToggleChild(),
//      ),
//      floatingActionButton: FloatingActionButton(
//        onPressed: _toggle,
//        tooltip: 'Update Text',
//        child: Icon(Icons.update),
//      ),
//    );
//  }

//  @override
//  Widget build(BuildContext context) {
//    // TODO: implement build
//    return Scaffold(
//      appBar: AppBar(
//        title: Text(this.textToShow),
//      ),
//      body: Center(
//        child: Text(textToShow),
//      ),
//      floatingActionButton: FloatingActionButton(
//        onPressed: _updateText,
//        tooltip: 'Update Text',
//        child: Icon(Icons.update),
//      ),
//    );
//  }
//}
